package com.novax.ex.activity.provider.service;

import com.novax.ex.activity.infrastructure.entity.OperationV2Rule;
import com.novax.ex.activity.infrastructure.entity.OperationV2SubRule;
import com.novax.ex.activity.infrastructure.mapper.OperationV2SubRuleMapper;
import com.novax.ex.common.base.BaseMapper;
import com.novax.ex.common.base.BaseService;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * @Description 活动落地页配置 子活动标题与规则V2
 * @Author ChenXi
 * @Date 2023/04/18/10:08
 */

@Service
public class OperationV2SubRuleService extends BaseService {

    @Resource
    private OperationV2SubRuleMapper operationV2SubRuleMapper;

    @Override
    protected BaseMapper getBaseMapper() {
        return operationV2SubRuleMapper;
    }

    /**
     * @Description: 查询规则多语言配置
     * @Author: ChenXi
     * @Date:  2024/4/25 15:47
     * @param operationSubId
     * @return: com.novax.ex.common.results.ReturnResult<java.util.List<com.novax.ex.activity.open.model.response.OperationV2RuleResponse>>
     **/
    public List<OperationV2SubRule> list(Long operationSubId) {
        return operationV2SubRuleMapper.selectListFromOperationId(operationSubId);
    }

    /**
     * @Description: 查询是否已存在多语言配置
     * @Author: ChenXi
     * @Date:  2024/4/25 16:49
     * @param operationSubId
     * @param language
     * @return: java.lang.Long
     **/
    public Long queryOperationIdAndLanguage(Long operationSubId, String language) {
        return operationV2SubRuleMapper.queryOperationIdAndLanguage(operationSubId, language);
    }

    /**
     * @Description: 查询是否已存在多语言配置
     * @Author: ChenXi
     * @Date:  2024/4/25 16:49
     * @param operationSubId
     * @param language
     * @return: java.lang.Long
     **/
    public OperationV2SubRule queryRule(Long operationSubId, String language) {
        return operationV2SubRuleMapper.queryRule(operationSubId, language);
    }

}
